package com.lisn.activityresultsapi;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class SecondActivity2 extends AppCompatActivity {
    private static final String TAG = SecondActivity2.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second2);
        Intent intent = getIntent();
        String first_send = intent.getStringExtra("first_send");
        Log.e(TAG, "onCreate: data = " + first_send);

        findViewById(R.id.second_button2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.putExtra("data", "data from com.lisn.activityresultsapi.SecondActivity2");
                setResult(RESULT_OK, intent);
                finish();
            }
        });
    }
}